<?

if($_REQUEST["action"]=="rosterRangs"){
	$sql->query("update ".CFG_MYSQL_PREFIX."module_config set valeur='".substr($_REQUEST["rangs"],0,-1)."' where module='roster' and nom='rangs'");
}

if($_REQUEST["action"]=="rosterMAJGuilde"){
	$json=armory_getGuild();
	if($json===false) echo "nok";
	else{
		$var=$sql->request_single("select * from ".CFG_MYSQL_PREFIX."module_config where module='roster' and nom='rangs'");
		$rangs=explode("|",$var->valeur);
		for($i=0;$i<sizeof($rangs);$i++){
			$rangs[$i]=explode(":",$rangs[$i]);
		}
	
		$tmp="";
		$node = $json->members;
		foreach($node as $char){
			if($rangs[intval($char->rank)][1]==1) $tmp.=$char->character->name."-".$char->rank.",";
		}
		echo substr($tmp,0,-1);
	}
}

if($_REQUEST["action"]=="rosterMAJPerso"){
	rosterMAJPerso($_REQUEST["nom"],$_REQUEST["rang"],true);
}

if($_REQUEST["action"]=="rosterPersosChangeUser"){
	$sql->query("UPDATE `".CFG_MYSQL_PREFIX."player` SET `idUser`=".$_REQUEST["idUser"]." WHERE `id`=".$_REQUEST["idPlayer"]);
	echo "<hr/>UPDATE `".CFG_MYSQL_PREFIX."player` SET `idUser`=".$_REQUEST["idUser"]." WHERE `id`=".$_REQUEST["idPlayer"]."<hr/>";
}

if($_REQUEST["action"]=="rosterPersosSetCasual"){
	$sql->query("UPDATE `".CFG_MYSQL_PREFIX."player` SET `casual`=1 WHERE `idUser`=".$_REQUEST["idUser"]);
	echo '<hr/>rosterPersosSetCasual : '.$_REQUEST["idUser"].'<hr/>';
}

if($_REQUEST["action"]=="rosterPersosSetUnCasual"){
	$sql->query("UPDATE `".CFG_MYSQL_PREFIX."player` SET `casual`=0 WHERE `idUser`=".$_REQUEST["idUser"]);
	echo '<hr/>rosterPersosSetUnCasual : '.$_REQUEST["idUser"].'<hr/>';
}
?>